package com.cn.web.controller.bc;

import com.alibaba.fastjson2.JSONObject;

import com.cn.bean.vo.bc.AssistsVo;
import com.cn.service.server.bc.AssistMaterialDetailsServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@CrossOrigin
@RestController
public class AssistMaterialDetailsController {
    private final AssistMaterialDetailsServer assistMaterialDetailsServer;

    @Autowired
    public AssistMaterialDetailsController(AssistMaterialDetailsServer assistMaterialDetailsServer) {
        this.assistMaterialDetailsServer = assistMaterialDetailsServer;
    }

    @RequestMapping("/select/AssistMaterial")
    @ResponseBody
    public List<AssistsVo> selectAssistMaterial(@RequestBody JSONObject jsonObject) {
        Integer page = jsonObject.getInteger("page");
        Integer limit = jsonObject.getInteger("limit");
        String id = jsonObject.getString("id");
        String fabh = jsonObject.getString("fabh");
        List<AssistsVo> assistsVos = assistMaterialDetailsServer.selectAssistsAll(id, fabh, limit, page);
        return assistsVos;
    }
    @RequestMapping("/select/Assists/All")
    @ResponseBody
    public List<AssistsVo> selectAssistsAll(@RequestBody JSONObject jsonObject) {
        Integer page = jsonObject.getInteger("page");
        Integer limit = jsonObject.getInteger("limit");
        String id = jsonObject.getString("id");
        String fabh = jsonObject.getString("fabh");
        List<AssistsVo> assistsVos = assistMaterialDetailsServer.selectAssists(id, fabh, limit, page);
        return assistsVos;
    }
}
